home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / TEST / POINT_TE.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.9 KB  |  91 lines

  1. package sub_arctic.test;
  2.  
  3.  
  4. import sub_arctic.lib.*;
  5. import sub_arctic.output.*;
  6. import sub_arctic.input.*;
  7. import sub_arctic.constraints.std_function;
  8.  
  9. import java.applet.Applet;
  10.  
  11. public class point_test extends debug_interactor_applet {
  12.   public void build_ui(base_parent_interactor top) {
  13.     display_help_container dhc1,dhc2,dhc3;
  14.  
  15.     /* create a button centered in the top level interactor */
  16.     button pointee = 
  17.       new status_button("Point At Me", null,
  18.             "This is a demo of the pointable input protocol",
  19.             this);
  20.     pointee.set_x_constraint(std_function.centered(PARENT.W(), 0));
  21.     pointee.set_y_constraint(std_function.far_edge_just(NEXT_SIBLING.Y(), 0));
  22.     /* make the button a child of the top level */
  23.     top.add_child(pointee);
  24.     /*
  25.        * make first display help container 
  26.        */
  27.     dhc1=new display_help_container(new button("I have help",null),
  28.                     "This is some help text");
  29.       
  30.     dhc1.set_x_constraint(std_function.centered(PARENT.W(), 0));
  31.     dhc1.set_y_constraint(std_function.centered(PARENT.H(), 0));
  32.     top.add_child(dhc1);
  33.     /*
  34.      * make second display help container 
  35.      */
  36.     dhc2=new display_help_container(new button("I have help also",null),
  37.                     "This is yet more help text");
  38.       
  39.     dhc2.set_x_constraint(std_function.centered(PARENT.W(), 0));
  40.     dhc2.set_y_constraint(std_function.offset(PREV_SIBLING.Y2(), 0));
  41.     top.add_child(dhc2);
  42.     /**
  43.      * make another help container  on the far right
  44.      */
  45.     dhc3=new display_help_container(new button("Helpable Button",null),
  46.                     "This is a really long piece of " +
  47.                     "help text to make sure we can see it");
  48.     dhc3.set_x_constraint(std_function.far_edge_just(PARENT.W(), 0));
  49.     dhc3.set_y_constraint(std_function.centered(PARENT.H(), 0));
  50.     top.add_child(dhc3);
  51.   }
  52. }
  53.  
  54. class status_button extends button implements pointable {
  55.   String st;
  56.   Applet applet;
  57.   public status_button(String label_text, callback_object co, 
  58.                String status_text, Applet app) {
  59.     super(label_text,co);
  60.     applet=app;
  61.     st=status_text;
  62.   }
  63.   /**
  64.    * Handle the mouse coming in
  65.    */
  66.   public boolean mouse_enter(event evt, Object user_info) {
  67.     applet.showStatus(st);
  68.     return true;
  69.   }
  70.   public void mouse_exit(event evt) {
  71.     applet.showStatus("");
  72.   }
  73.  
  74. }
  75. /*=========================== COPYRIGHT NOTICE ===========================
  76.  
  77. This file is part of the subArctic user interface toolkit.
  78.  
  79. Copyright (c) 1996 Scott Hudson and Ian Smith
  80. All rights reserved.
  81.  
  82. The subArctic system is freely available for most uses under the terms
  83. and conditions described in 
  84.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  85. and appearing in full in the lib/interactor.java source file.
  86.  
  87. The current release and additional information about this software can be 
  88. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  89.  
  90. ========================================================================*/
  91.